package com.edu.hre.struts.form.leave;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.apache.struts.action.ActionForm;

import com.edu.hre.common.entity.HrePageInfo;
import com.edu.hre.common.utils.CommonUtils;
import com.edu.hre.struts.form.admin.ConfigurationForm;

public class LeaveRequestListForm extends ActionForm {
	
	/**
	 * 
	 */
	private static final SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy"); 
	private static final long serialVersionUID = 6903531263451354321L;
	private List<LeaveRequestForm> listObjs = new ArrayList<LeaveRequestForm>();
	private List<HrePageInfo> listPages = new ArrayList<HrePageInfo>();
	private Date fromDate = null;
	private Date toDate = null;
	private boolean canAdd = false;
    private boolean canDelete = false;
    private boolean isAsc = true;
    private int totalItems = 0;
	private int totalPage = 0;
	

	public List<HrePageInfo> getListPages() {
		return listPages;
	}

	public void setListPages(List<HrePageInfo> listPages) {
		this.listPages = listPages;
	}

	public boolean isCanAdd() {
		return canAdd;
	}

	public void setCanAdd(boolean canAdd) {
		this.canAdd = canAdd;
	}

	public boolean isCanDelete() {
		return canDelete;
	}

	public void setCanDelete(boolean canDelete) {
		this.canDelete = canDelete;
	}

	public boolean isAsc() {
		return isAsc;
	}

	public void setAsc(boolean isAsc) {
		this.isAsc = isAsc;
	}

	public int getTotalItems() {
		return totalItems;
	}

	public void setTotalItems(int totalItems) {
		this.totalItems = totalItems;
	}

	public int getTotalPage() {
		return totalPage;
	}

	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}

	public List<LeaveRequestForm> getListObjs() {
		return listObjs;
	}

	public void setListObjs(List<LeaveRequestForm> listObjs) {
		this.listObjs = listObjs;
	}

	public Date getToDate() {
		return toDate;
	}

	public void setToDate(Date toDate) {
		this.toDate = toDate;
	}

	public Date getFromDate() {
		return fromDate;
	}

	public void setFromDate(Date fromDate) {
		this.fromDate = fromDate;
	}
	
	public String getToDateStr() {
		if(this.toDate == null){
			return "";
		}
		return dateFormat.format(this.toDate);
	}

	public void setToDateStr(String toDate) {
		try {
			this.toDate = dateFormat.parse(toDate);
		} catch (Exception e) { 
			CommonUtils.println(e.getMessage());
		}
	}

	public String getFromDateStr() {
		if(this.fromDate == null){
			return "";
		}
		return dateFormat.format(this.fromDate);
	}

	public void setFromDateStr(String fromDate) {
		try {
			this.fromDate = dateFormat.parse(fromDate);
		} catch (Exception e) { 
			CommonUtils.println(e.getMessage());
		}
	}
	
	
}
